package com.googlecode.mgwt.expenses.client.gin;

import com.google.gwt.inject.client.AbstractGinModule;
import com.google.gwt.place.shared.PlaceController;
import com.google.inject.Singleton;
import com.google.web.bindery.event.shared.EventBus;
import com.google.web.bindery.event.shared.SimpleEventBus;
import com.googlecode.gwtphonegap.client.PhoneGap;
import com.googlecode.mgwt.expenses.client.AppHistoryObserver;
import com.googlecode.mgwt.expenses.client.ContextProvider;
import com.googlecode.mgwt.expenses.client.activities.el.ExpenseListActivity;
import com.googlecode.mgwt.expenses.client.misc.PhoneGapProvier;
import com.googlecode.mgwt.expenses.client.misc.PlaceControllerProvider;
import com.googlecode.mgwt.expenses.client.rpc.ExpenseDataService;
import com.googlecode.mgwt.expenses.client.rpc.ExpenseServiceLocalStorageImpl;
import com.googlecode.mgwt.storage.client.LocalStorageGwtImpl;
import com.googlecode.mgwt.storage.client.Storage;

public class AbstractExpenseGinModule extends AbstractGinModule {

	@Override
	protected void configure() {

		bind(AppHistoryObserver.class).in(Singleton.class);

		bind(PhoneGap.class).toProvider(PhoneGapProvier.class).in(Singleton.class);

		bind(ContextProvider.class).to(AppHistoryObserver.class).in(Singleton.class);

		bind(EventBus.class).to(SimpleEventBus.class).in(Singleton.class);

		bind(PlaceController.class).toProvider(PlaceControllerProvider.class).in(Singleton.class);

		bind(ExpenseListActivity.class).in(Singleton.class);

		bind(ExpenseDataService.class).to(ExpenseServiceLocalStorageImpl.class).in(Singleton.class);

		bind(Storage.class).to(LocalStorageGwtImpl.class).in(Singleton.class);

	}

}
